<script>
$(document).ready(function() {
    if (<?= $this->max_acl ?> >= 3) {
        url = location.href;
        $("#dialog").dialog("destroy");
        $("#dialog").dialog({
                bgiframe: false,
                modal: true,
                width: 630,
                title: '<?= $this->t->_('Access') ?>',
                close: function() {$(this).dialog('close');},
                buttons: {
                        '<?= $this->t->_('Save') ?>': function() {
                           $('#ajax_form').ajaxSubmit({
                                target:  '#dialog',
                                success: function() {
                                    $(this).dialog('close');
                                    $("#dialog").empty();
                                    $.ajax({
                                        url: url.substr(0, url.length - 1),
                                        cache: false,
                                        dataType: "html",
                                        success: function(message)
                                        {
                                            $("#ajax_content").empty().append(message);
                                        }
                                    });
                                }
                           });
                           $("#dialog").empty();
                           return false;
                        },
                        '<?= $this->t->_('Cancel') ?>': function() {
                           $(this).dialog('close');
                        }
                }
        });
    } else {
		$("#dialog").dialog({
			modal: true,
                        title: '<?= $this->t->_('Warning') ?>',
                        width: 300,
                        height: 150,
                        resizable: false,
			buttons: {
				Ok: function() {
					$(this).dialog('close');
				}
			}
		});
               }
});
</script>
<?php 
    if ($this->max_acl >= 3){
        echo $this->form;
    } else {?>

<?= $this->t->_("You don't have permission to access") ?>

<?php } ?>

